package main
import "fmt"

// pings是一个只能发送数据的通道
func ping(pings chan<- string,msg string){
	pings <- msg
}
// pongs是一个只能接收的通道
func pong(pongs <-chan string,pings chan<- string){
	msg := <-pongs
	pings <- msg
}

func main(){
	pings := make(chan string,1)
	pongs := make(chan string,1)

	ping(pings,"hahaha")
	pong(pings,pongs)

	fmt.Println(<-pongs)
}